		function trim(val)
		{
			 return val.replace(/(^\s*)|(\s*$)/g, "");  
		}

		function checkInfo(){
			var area_id = document.getElementById("area_id").value;
			if(area_id==""){
			  alert('请选择地区');
			  return false;
			}
			var area_name = document.getElementById("area_id").options[document.getElementById("area_id").selectedIndex].text;
			document.getElementById("shipping_area_name").value = area_name;
			
			var type = document.getElementById('cal_type').value;
			var one_fare = document.getElementById('one_fare').value;
			var first_fare = document.getElementById('first_fare').value;
			var con_fare = document.getElementById('con_fare').value;
			var free_fare = document.getElementById('free_fare').value;
			if(trim(one_fare) ==""){
			document.getElementById('one_fare').value='0';		
			}
			if(trim(first_fare) ==""){
			document.getElementById('first_fare').value='0';			
			}
			if(trim(con_fare) ==""){
			document.getElementById('con_fare').value='0';			
			}
			if(trim(free_fare) ==""){
			document.getElementById('free_fare').value='0';			
			}
				if(type==0){		
					if(trim(first_fare)==""){
					  alert('请输入首重费用');
					  return false;
					}
					if(trim(con_fare)==""){
					  alert('请输入续重费用');
					  return false;
					}
				}
				if(type==1){		
				if(trim(one_fare)==""){
					  alert('请输入单件费用');
					  return false;
					}
			}
		 
			document.addForm.submit();
		}
		
		function checkvalue(val){
		 document.getElementById("cal_type").value=val;	
		 }